/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 23735
 * Date: 2023-06-17
 * Time: 21:53
 */

public class Solution {
    public int findMin(int[] nums) {
        int left = 0;
        int right = nums.length - 1;
        while (left < right) {
            int mid = ((right - left) >> 1) + left;
            // 最简洁的方法是 mid 与 right 比较, 只要 mid < right, 直接就可以排除 mid 右边的部分
            if (nums[mid]  >= nums[left] && nums[mid] > nums[right]) {
                left = mid + 1;
            }else {
                // right = mid 是为了能够包括那个最小的元素
                right = mid;
            }
        }
        return nums[left];
    }
}
